var xmlhttp;

function getXmlHttpObject()
{
	if (window.XMLHttpRequest)
	  {// code for IE7+, Firefox, Chrome, Opera, Safari
	  xmlhttp=new XMLHttpRequest();
	  }
	else
	  {// code for IE6, IE5
	  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
	  }
	return xmlhttp;
}

function deleteSet(setId)
{
	getXmlHttpObject();

	var url = "../controllers/deleteSet.php";
	params = "setId=" + setId;
	
	xmlhttp.open("POST",url,true);
	xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	xmlhttp.setRequestHeader("Content-length", params.length);
	xmlhttp.setRequestHeader("Connection", "close");
	xmlhttp.onreadystatechange = deleteSetSuccess;
	xmlhttp.send(params);
	
}

function deleteSetSuccess() {
	if (xmlhttp.readyState == 4)
		if (xmlhttp.status == 200)
		{
			location.reload();
		}
	    else if (request.status == 404)
	        alert("请求的链接不存在");
	    else
	        alert("错误: 错误代码 " + xmlhttp.status);
}


function gotoUpdateTopic(setId)
{
	var requestUrl = "../views/edittopic.php?setId=" + setId;
	window.location.href=requestUrl;
}